<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>客户罚息管理</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">客户名称</div>
                    <div class="field">
                        <input name=cstNm id="cstNm" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">罚息金额</div>
                    <div class="field">
                        <input ligerui="width:82" name="fineAmtMin" id="fineAmtMin" type="text" class="ui-textbox" value="" validate="{number:true}">
                        -
                        <input ligerui="width:82" name="fineAmtMax" id="fineAmtMax" type="text" class="ui-textbox" value="" validate="{number:true}">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">逾期金额</div>
                    <div class="field">
                        <input ligerui="width:82" name="ovdAmtMin" id="ovdAmtMin" type="text" class="ui-textbox" value="" validate="{number:true}">
                        -
                        <input ligerui="width:82" name="ovdAmtMax" id="ovdAmtMax" type="text" class="ui-textbox" value="" validate="{number:true}">
                    </div>
                </div>
                <div class="clearFix"></div>
                <div class="formBtns notRight">
                    <span id="searchBtn" class="sq-button-round">查询</span>
                    <span id="clearBtn" class="sq-button-round">清空</span>
                    <span id="applyReduBtn" class="sq-button-round">减免申请</span>
                    <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                </div>
            </div>
        </form>
    </div>
    <div id="ligergrid1" class="sq-grid"></div>
</div>

<script type="text/javascript">
    var grid = null;
    $("#searchBar").ligerForm({
        validate: true
    });
    $(function () {
        grid = $("#ligergrid1").ligerGrid({
            url: '<%=path%>/risk/ovdCollect/initFineList.do',
            method: 'get',
            columns: [
                /*{display: '客户ID', name: 'cstId', minWidth: 100, align: 'left', enabledSort: false},*/
                {display: '客户名称', name: 'cstNm', minWidth: 100, align: 'left', enabledSort: false,},
                {display: '应收金额(元)', name: 'arAmt', minWidth: 100, align: 'right', enabledSort: false,
                    render:function(rowdata,index,value){
                        if(value){
                            return '&yen;'+FormatMoney(rowdata.arAmt/100);
                        }
                    }
                },
                {display: '逾期金额(元)', name: 'ovdAmt', minWidth: 100, align: 'right', enabledSort: false,
                    render:function(rowdata,index,value){
                        if(value){
                            return '&yen;'+FormatMoney(rowdata.ovdAmt/100);
                        }
                    }
                },
                {display: '罚息金额(元)', name: 'fineAmt', minWidth: 100, align: 'right', enabledSort: false,
                    render:function(rowdata,index,value){
                        if(value){
                            return '&yen;'+FormatMoney(rowdata.fineAmt/100);
                        }
                    }
                },
                {display: '当天应还租金(元)', name: 'rentAmt', minWidth: 100, align: 'right', enabledSort: false,
                    render:function(rowdata,index,value){
                        if(value){
                            return '&yen;'+FormatMoney(rowdata.rentAmt/100);
                        }else{
                            return '0.00';
                        }
                    }
                },
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            checkbox: true,
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: false
        });
        grid.setHeight(100);

        $("#searchBar").ligerForm();

        $("#pageloading").hide();

        /* 查询 */
        $("#searchBtn").click(function (event) {
            var form = liger.get("searchBar");
            if(!form.valid()){
                $.ligerDialog.SQalert({content: "请填入正确的数据类型！", SQ_type: "warning"});
                return ;
            }
            var data = form.getData();
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            grid.reload();
        });

        /* 清空 */
        $("#clearBtn").click(function (event) {
            $("#resetBtn").click();  //重置 input-text
            var form = liger.get("searchBar");
            form.setData({  //重置select等特殊表单
                "*Cd": " "
            });
        });

        var callback = function () {
            grid.reload();
        };

        /* 减免申请 */
        $("#applyReduBtn").click(function (event) {
            var selectedRows = grid.getSelectedRows();
            if (selectedRows.length != 1) {
                $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_SELECT_ONLY_A_ROW, SQ_type: "warning"});
                return;
            }
            var _cstId = selectedRows[0].cstId;
            Add_navTab("applyReduction_"+_cstId, "罚息减免", '<%=path%>/capital/capOverdueInfo/toReductionPage.do?cstId='+_cstId, callback);
        });

    });

</script>

</body>
</html>
